package com.liujt.util.redis;

import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component;

/**
 * Created by liujt on 2017/2/21.
 */
@Component
public class SmsMessageListener implements MessageListener {

    private volatile RedisSerializer<String> keySerializer = new StringRedisSerializer();

    @Override public void onMessage(Message message) {
        Object key = message.getKey();
        String val = keySerializer.deserialize(message.getVal());
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
